@extends('index.user.index')
@section('navbar')
    <ol class="breadcrumb">
        <li><a href="{{url('/')}}">首页</a></li>
        <li><a href="{{url('/user')}}">用户中心</a></li>
        <li class="active">失物招领</li>
    </ol>
@endsection
@section('user-content')
    <div class="panel panel-default">
        <div class="panel-heading">
            {{$item->name}} <span class="badge">{{$item->typeName()}}</span>

            <span class="badge">{{$item->status()}}</span>
        </div>
        <div class="panel-body">
            @if($images = $item->images)
                <div id="item_images" class="carousel slide" data-ride="carousel">
                    <div class="carousel-inner" role="listbox">
                        @foreach($images as $key => $image)
                            <div class="item <?=$key == 0 ? 'active' : ''?>">
                                <img src="{{$image->url}}" style="width:100%;height:200px;">
                            </div>
                        @endforeach
                    </div>
                    <a class="left carousel-control" href="#item_images" role="button"
                       data-slide="prev">
                        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                        <span class="sr-only">Previous</span>
                    </a>
                    <a class="right carousel-control" href="#item_images" role="button"
                       data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                        <span class="sr-only">Next</span>
                    </a>
                </div>
                <hr>
            @endif
            <p>{{$item->findLostTime()}}</p>

            <p>酬金： {{$item->wanted_fee}}元</p>

            <p>{{$item->p_catalog->name . '-' . $item->catalog->name}}</p>

            <p>{{$item->address()}}</p>

            <p>{{$item->describe}}</p>
        </div>
    </div>
    @if($item->match && $matchItem = $item->matchItem())
        <div class="panel panel-default">
            <div class="panel-heading">
                {{$matchItem->name}}
                <span class="badge">认领信息</span>
            </div>
            <div class="panel-body">
                @if($images = $matchItem->images)
                    <div id="matchItem_images" class="carousel slide" data-ride="carousel">
                        <div class="carousel-inner" role="listbox">
                            @foreach($images as $key => $image)
                                <div class="item <?=$key == 0 ? 'active' : ''?>">
                                    <img src="{{$image->url}}" style="width:100%;height:200px;">
                                </div>
                            @endforeach
                        </div>
                        <a class="left carousel-control" href="#matchItem_images" role="button"
                           data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
                            <span class="sr-only">Previous</span>
                        </a>
                        <a class="right carousel-control" href="#matchItem_images" role="button"
                           data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
                            <span class="sr-only">Next</span>
                        </a>
                    </div>
                    <hr>
                @endif
                <p>{{$matchItem->user->name}}</p>

                <p>{{$matchItem->findLostTime()}}</p>

                <p>酬金： {{$item->wanted_fee}}元</p>

                <p>{{$matchItem->p_catalog->name . '-' . $matchItem->catalog->name}}</p>

                <p>{{$matchItem->address()}}</p>

                <p>{{$matchItem->describe}}</p>
            </div>
        </div>
    @endif
@endsection